//package com.gitlab.lucky.admin.service;
//
//import com.gitlab.lucky.common.dao.mapper.AdminAuthorityMapper;
//import com.gitlab.lucky.common.dao.mapper.AdminRoleAuthorityMapper;
//import com.gitlab.lucky.common.dao.mapper.AdminRoleUserMapper;
//import com.gitlab.lucky.common.dao.model.AdminAuthority;
//import com.gitlab.lucky.common.dao.model.AdminRole;
//import com.gitlab.lucky.common.dao.model.AdminRoleAuthority;
//import com.gitlab.lucky.common.dao.model.AdminRoleUser;
//import com.gitlab.lucky.common.service.ServiceImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import tk.mybatis.mapper.entity.Example;
//
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.List;
//
///**
// * @program: lucky
// * @author: Mr.Han
// * @create: 2019-04-21 18:20
// **/
//@Service
//public class AdminAuthorityService extends ServiceImpl<AdminAuthorityMapper, AdminAuthority> {
//    @Autowired
//    private AdminRoleAuthorityService adminRoleAuthorityService;
//    public List<AdminAuthority> getAuthority(List<AdminRole> roles) {
//        ArrayList roleId = new ArrayList<>();
//        ArrayList authorityId = new ArrayList<>();
//        for (AdminRole role : roles) {
//            roleId.add(role.getId());
//        }
//        /**
//         * 通过角色查询权限
//         */
//        Example example = new Example(AdminRoleAuthority.class);
//        example.createCriteria().andIn("roleId",roleId);
//        List<AdminRoleAuthority> adminRoleAuthorities = adminRoleAuthorityService.selectByExample(example);
//        for (AdminRoleAuthority adminRoleAuthority : adminRoleAuthorities) {
//            authorityId.add(adminRoleAuthority.getAuthorityId());
//        }
//        Example example1 = new Example(AdminAuthority.class);
//        example1.createCriteria().andIn("id",authorityId);
//        List<AdminAuthority> adminRoleAuthorities1 = this.selectByExample(example1);
//        return adminRoleAuthorities1;
//    }
//}
